package com.kaifamiao.www.demo.do0813;

public class Fibonacci {
    public static void main(String[] args) {
        Fibonacci fibonacci = new Fibonacci();
//        Scanner sc = new Scanner(System.in);
//        System.out.println("请输入要求斐波那契数列的第几位数字");
//        int N;
//        N = sc.nextInt();
//        System.out.println(fibonacci.fibo(N));
        for (int counter = 1;counter <= 10;counter++){
            System.out.println(fibonacci.fibo(counter));
        }
    }
    //用递归方法求斐波那契数列
    public  long fibo(long n) {
        if ((n == 0) || (n == 1)) {
            return n;
        } else {
            return fibo(n - 1) + fibo(n - 2);
        }
    }

}


